﻿
#include "CUpdateMissionItemInfo.h"
#include "../share/user_define.h"


//-------------------------------------------------------------------------------
CUpdateMissionItemInfo::CUpdateMissionItemInfo(uint32_t uid, uint32_t pn)
	: BaseMessage(uid, pn)
{
	_safe_guard_begin;
	_safe_guard_end;
}

//-------------------------------------------------------------------------------
CUpdateMissionItemInfo::~CUpdateMissionItemInfo(void)
{

}

//-------------------------------------------------------------------------------
void CUpdateMissionItemInfo::SetMissionItemInfoData(MissionSystem * MissionData
	, uint32_t index)
{
	_safe_guard_begin;

	_safe_check(MissionData);

	Json::Value jv;
	jv.clear();

	mission* p = MissionData->GetMissionInfoByIndex(index);
	if (nullptr == p)
	{
		m_jv["ret"] = 0;
		return;
	}
	_safe_check(p);

	uint32_t idx = index;
	jv.append(idx);//idx
	jv.append(p->m_mission_id);
	jv.append(p->m_scrip_id);
	jv.append(p->m_is_available);
	jv.append(p->m_info.GetValue(0));
	jv.append(p->m_info.GetValue(1));
	jv.append(p->m_info.GetValue(2));
	jv.append(p->m_info.GetValue(3));
	jv.append(p->m_npc_id);
	jv.append(p->m_type);
	jv.append(p->m_star);

	m_jv["misinfo"] = jv;//misn_item
	m_jv["ret"] = 0;

	_safe_guard_end;
}
